<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="en" />
<!-- 	import bootstrap -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link
	href="<?php echo Yii::app()->request->baseUrl; ?>/js/libs/bootstrap/css/bootstrap.min.css"
	rel="stylesheet">
<link
	href="<?php echo Yii::app()->request->baseUrl; ?>/js/libs/bootstrap/css/bootstrap-responsive.css"
	rel="stylesheet">

<!-- import seajs config js -->
<script
	src="<?php echo Yii::app()->request->baseUrl; ?>/js/seajs/sea.js"
	type="text/javascript" data-config="<?php echo Yii::app()->request->baseUrl; ?>/js/seajs-config"></script>	
<script type="text/javascript">
// init bootstrap script
seajs.use(['bootstrap'],function(){
	<?php if(!Yii::app ()->user->isGuest){?>
		$.get(HOST+'/pay/cart/cartNum',function(data){
			if(data.status == 0){
				 $('#cart_num').html(data.data);
			}else{
				 $('#cart_num').html(0);
			}
		})
	<?php }?>

// 	$('#searchProduct').keydown(function(e){
// 		if(e.which == 13){
// 			var text = $(this).val();
// 			alert(text);
// 		}
// 	});
	
});
</script>
<title><?php echo CHtml::encode($this->pageTitle); ?></title>
<script type="text/javascript">
var HOST = '<?php echo Yii::app()->request->baseUrl; ?>';
</script>
</head>

<body>
	<div class="navbar  navbar-static-top">
		<div class="navbar-inner">
			<div class="container">

				<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
				<a class="btn btn-navbar" data-toggle="collapse"
					data-target=".nav-collapse"> <span class="icon-bar"></span> <span
					class="icon-bar"></span> <span class="icon-bar"></span>
				</a>
				<!-- Be sure to leave the brand out there if you want it shown -->
				<a class="brand" href="#"><?php echo CHtml::encode(Yii::app()->name); ?></a>
				<!-- Everything you want hidden at 940px or less, place within here -->
				<div class="nav-collapse collapse"></div>
				<?php
				$this->widget ( 'zii.widgets.CMenu', array (
						'htmlOptions' => array (
								'class' => 'nav' 
						),	'encodeLabel'=>false,
						'activeCssClass' => 'active',
						'items' => array (
								array (
										'label' => '首页',
										'url' => array (
												'/site/index' 
										) 
								),array(
										
										'label' => '购物车<span class="badge badge-important" id="cart_num"></span>',
										'url' => array (
												'/pay/default/cart'
										),
										'visible' => !Yii::app ()->user->isGuest
								),
									array(
										'label' => '订单',
										'url' => array (
												'/pay/default/order'
										),
										'visible' => !Yii::app ()->user->isGuest
								),
								array (
										'label' => '用户',
										'url' => array (
												'/site/login' 
										),
										'visible' => Yii::app ()->user->isGuest 
								),
								array (
										'label' => '注销 (' . Yii::app ()->user->name . ')',
										'url' => array (
												'/site/logout' 
										),
										'visible' => ! Yii::app ()->user->isGuest 
								)
						) 
				) );
				?>
			</div>
		</div>
	</div>
	<div class="container" style="min-height:540px;_min-height:540px;">
			<?php echo $content; ?>
	</div>
	<!-- page -->
	<div id="footer" align="center">
		<a href="<?php echo $this->createUrl('/manage');?>">后台管理</a>
	</div>
</body>
</html>
